package com.cy.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @ClassName RestProviderController
 * @Description:类描述
 * @Author Tedu
 * @Date 2021/5/31 16:47
 * @Version V1.0
 **/
@RestController
@RequestMapping("/provider/template/")
public class RestProviderController {
    @Value("${server.port}")
    private String server;

    /**
     * @Description: 方法描述
     * @Author: Tedu
     * @Date: 2021/5/31 17:07
     * @Param: [id]
     * @Return: void
     */

    @DeleteMapping("{id}")
    public void doDelete(@PathVariable Integer id){
        System.out.println(id+"is delete by"+server);
    }

    @PostMapping
    public Map<String, Object> doPost(@RequestBody Map<String, Object> map){
        System.out.println("consumer post data"+map);
        map.put("status", 1);
        map.put("server.port", server);
        return map;
    }
    
    @PutMapping
    public void doPut(@RequestBody Map<String, Object> map){
        System.out.println("consumer put data"+map);
    }
}
